﻿#ifndef __SOCKETTCPCLIENT_H__
#define __SOCKETTCPCLIENT_H__

#include "SocketTcp.h"

class IOTcpClientNotify
{
public:
	IOTcpClientNotify(void){};
	virtual~IOTcpClientNotify(void){};
public:
	virtual void OnRecvTcpServerDataNotify(const int nCmd, const int nPacketNum, const int nSendId, const char *szBuf, int nLen) = 0;
	virtual void OnDisConnTcpServerNotify(const int nType) = 0;
};

class CSocketTcpClientImpl;
class CSocketTcpClient
{
public:
	CSocketTcpClient(IOTcpClientNotify *pNotify, bool bCheckConn = false);
	~CSocketTcpClient();

	bool StartConnect(const char *szIP, unsigned short usPort);
	void DisConnect(void);

	int SendData(const int nUserId, const int nCmd, int nPacketNum, const char *pData, int nLen);
	int SendDataEx(const char *pData, int nLen);

	void SetCheckTime(int nTime);
	SOCKET GetSocket(void);
	bool IsConnect();

private:
	CSocketTcpClientImpl		*m_pImpl;
};

#endif
